import request from '@/utils/request'

// 获取购物车
export const getShoppingCartAPI = () => request.get('/api/cart')

// 添加购物车
export const addShoppingCartAPI = (data: any) => request.post('/api/cart', data)

// 删除购物车商品
export const deleteShoppingCartAPI = (productId: number) => request.delete('/api/cart', { data: { id: productId } })

// 修改购物车商品
export const updateShoppingCartAPI = (data: any) => request.put('/api/cart', data)

// 全选
export const checkAllShoppingCartAPI = (data: any) => request.post('/api/cart/checkAll', data)

// 批量删除，只留提交的商品
export const deleteProductsInCartAPI = (data: any) => request.delete('/api/cart/products', { data })
